<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Detailed Semantics - Optional References</title>
<link rel="stylesheet" href="../../../../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot">
<link rel="home" href="../../../index.html" title="Boost.Optional">
<link rel="up" href="../../../optional/reference/header__boost_optional_optional_hpp_.html" title="Header &lt;boost/optional/optional.hpp&gt;">
<link rel="prev" href="detailed_semantics___optional_values.html" title="Detailed Semantics - Optional Values">
<link rel="next" href="detailed_semantics___free_functions.html" title="Detailed Semantics - Free Functions">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
<td align="center"><a href="../../../../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="detailed_semantics___optional_values.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../../optional/reference/header__boost_optional_optional_hpp_.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="detailed_semantics___free_functions.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="boost_optional.reference.header__boost_optional_optional_hpp_.detailed_semantics___optional_references"></a><a class="link" href="detailed_semantics___optional_references.html" title="Detailed Semantics - Optional References">Detailed
        Semantics - Optional References</a>
</h4></div></div></div>
<p>
          <span class="inlinemediaobject"><img src="../../../images/space.png" alt="space"></span>
        </p>
<a name="reference_optional_ref_default_ctor"></a><div class="blockquote"><blockquote class="blockquote"><p>
            <code class="computeroutput"><span class="identifier">optional</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">&amp;&gt;::</span><span class="identifier">optional</span><span class="special">()</span>
            <span class="keyword">noexcept</span><span class="special">;</span></code>
          </p></blockquote></div>
<div class="blockquote"><blockquote class="blockquote"><p>
            <code class="computeroutput"><span class="identifier">optional</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">&amp;&gt;::</span><span class="identifier">optional</span><span class="special">(</span><span class="identifier">none_t</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span></code>
          </p></blockquote></div>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
              <span class="bold"><strong>Postconditions:</strong></span> <code class="computeroutput"><span class="keyword">bool</span><span class="special">(*</span><span class="keyword">this</span><span class="special">)</span> <span class="special">==</span> <span class="keyword">false</span></code>; <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code> refers to nothing.
            </li></ul></div>
<p>
          <span class="inlinemediaobject"><img src="../../../images/space.png" alt="space"></span>
        </p>
<a name="reference_optional_ref_value_ctor"></a><div class="blockquote"><blockquote class="blockquote"><p>
            <code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">R</span><span class="special">&gt;</span> <span class="identifier">optional</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">&amp;&gt;::</span><span class="identifier">optional</span><span class="special">(</span><span class="identifier">R</span><span class="special">&amp;&amp;</span> <span class="identifier">r</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span></code>
          </p></blockquote></div>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
              <span class="bold"><strong>Postconditions:</strong></span> <code class="computeroutput"><span class="keyword">bool</span><span class="special">(*</span><span class="keyword">this</span><span class="special">)</span> <span class="special">==</span> <span class="keyword">true</span></code>; <code class="computeroutput"><span class="identifier">addressof</span><span class="special">(**</span><span class="keyword">this</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">addressof</span><span class="special">(</span><span class="identifier">r</span><span class="special">)</span></code>.
            </li>
<li class="listitem">
              <span class="bold"><strong>Remarks:</strong></span> Unless <code class="computeroutput"><span class="identifier">R</span></code>
              is an lvalue reference, the program is ill-formed. This constructor
              does not participate in overload resolution if <code class="computeroutput"><span class="identifier">decay</span><span class="special">&lt;</span><span class="identifier">R</span><span class="special">&gt;</span></code> is an instance of <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">optional</span></code>.
            </li>
<li class="listitem">
              <span class="bold"><strong>Notes:</strong></span> This constructor is declared
              <code class="computeroutput"><span class="keyword">explicit</span></code> on compilers
              that do not correctly support binding to const lvalues of integral types.
              For more details <a class="link" href="../../dependencies_and_portability/optional_reference_binding.html#optional_reference_binding">see here</a>.
            </li>
<li class="listitem">
              <span class="bold"><strong>Example:</strong></span>
<pre class="programlisting"><span class="identifier">T</span> <span class="identifier">v</span><span class="special">;</span>
<span class="identifier">T</span><span class="special">&amp;</span> <span class="identifier">vref</span> <span class="special">=</span> <span class="identifier">v</span> <span class="special">;</span>
<span class="identifier">optional</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">&amp;&gt;</span> <span class="identifier">opt</span><span class="special">(</span><span class="identifier">vref</span><span class="special">);</span>
<span class="identifier">assert</span> <span class="special">(</span> <span class="special">*</span><span class="identifier">opt</span> <span class="special">==</span> <span class="identifier">v</span> <span class="special">)</span> <span class="special">;</span>
<span class="special">++</span> <span class="identifier">v</span> <span class="special">;</span> <span class="comment">// mutate referee</span>
<span class="identifier">assert</span> <span class="special">(*</span><span class="identifier">opt</span> <span class="special">==</span> <span class="identifier">v</span><span class="special">);</span>
</pre>
            </li>
</ul></div>
<p>
          <span class="inlinemediaobject"><img src="../../../images/space.png" alt="space"></span>
        </p>
<a name="reference_optional_ref_cond_value_ctor"></a><div class="blockquote"><blockquote class="blockquote"><p>
            <code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">R</span><span class="special">&gt;</span> <span class="identifier">optional</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">&amp;&gt;::</span><span class="identifier">optional</span><span class="special">(</span><span class="keyword">bool</span> <span class="identifier">cond</span><span class="special">,</span> <span class="identifier">R</span><span class="special">&amp;&amp;</span>
            <span class="identifier">r</span><span class="special">)</span>
            <span class="keyword">noexcept</span><span class="special">;</span></code>
          </p></blockquote></div>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
              <span class="bold"><strong>Effects: </strong></span> Initializes <code class="computeroutput"><span class="identifier">ref</span></code> with expression <code class="computeroutput"><span class="identifier">cond</span> <span class="special">?</span>
              <span class="identifier">addressof</span><span class="special">(</span><span class="identifier">r</span><span class="special">)</span> <span class="special">:</span> <span class="keyword">nullptr</span></code>.
            </li>
<li class="listitem">
              <span class="bold"><strong>Postconditions:</strong></span> <code class="computeroutput"><span class="keyword">bool</span><span class="special">(*</span><span class="keyword">this</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">cond</span></code>; If <code class="computeroutput"><span class="keyword">bool</span><span class="special">(*</span><span class="keyword">this</span><span class="special">)</span></code>, <code class="computeroutput"><span class="identifier">addressof</span><span class="special">(**</span><span class="keyword">this</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">addressof</span><span class="special">(</span><span class="identifier">r</span><span class="special">)</span></code>.
            </li>
<li class="listitem">
              <span class="bold"><strong>Remarks:</strong></span> Unless <code class="computeroutput"><span class="identifier">R</span></code>
              is an lvalue reference, the program is ill-formed. This constructor
              does not participate in overload resolution if <code class="computeroutput"><span class="identifier">decay</span><span class="special">&lt;</span><span class="identifier">R</span><span class="special">&gt;</span></code> is an instance of <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">optional</span></code>.
            </li>
</ul></div>
<p>
          <span class="inlinemediaobject"><img src="../../../images/space.png" alt="space"></span>
        </p>
<a name="reference_optional_ref_copy_ctor"></a><div class="blockquote"><blockquote class="blockquote"><p>
            <code class="computeroutput"><span class="identifier">optional</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">&amp;&gt;::</span><span class="identifier">optional</span> <span class="special">(</span>
            <span class="identifier">optional</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">rhs</span>
            <span class="special">)</span> <span class="keyword">noexcept</span>
            <span class="special">;</span></code>
          </p></blockquote></div>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
              <span class="bold"><strong>Effects: </strong></span> Initializes <code class="computeroutput"><span class="identifier">ref</span></code> with expression <code class="computeroutput"><span class="identifier">rhs</span><span class="special">.</span><span class="identifier">ref</span></code>.
            </li>
<li class="listitem">
              <span class="bold"><strong>Postconditions:</strong></span> <code class="computeroutput"><span class="keyword">bool</span><span class="special">(*</span><span class="keyword">this</span><span class="special">)</span> <span class="special">==</span> <span class="keyword">bool</span><span class="special">(</span><span class="identifier">rhs</span><span class="special">)</span></code>.
            </li>
<li class="listitem">
              <span class="bold"><strong>Example:</strong></span>
<pre class="programlisting"><span class="identifier">optional</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">&amp;&gt;</span> <span class="identifier">uninit</span> <span class="special">;</span>
<span class="identifier">assert</span> <span class="special">(!</span><span class="identifier">uninit</span><span class="special">);</span>

<span class="identifier">optional</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">&amp;&gt;</span> <span class="identifier">uinit2</span> <span class="special">(</span> <span class="identifier">uninit</span> <span class="special">)</span> <span class="special">;</span>
<span class="identifier">assert</span> <span class="special">(</span> <span class="identifier">uninit2</span> <span class="special">==</span> <span class="identifier">uninit</span> <span class="special">);</span>

<span class="identifier">T</span> <span class="identifier">v</span> <span class="special">=</span> <span class="number">2</span> <span class="special">;</span> <span class="identifier">T</span><span class="special">&amp;</span> <span class="identifier">ref</span> <span class="special">=</span> <span class="identifier">v</span> <span class="special">;</span>
<span class="identifier">optional</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">&gt;</span> <span class="identifier">init</span><span class="special">(</span><span class="identifier">ref</span><span class="special">);</span>
<span class="identifier">assert</span> <span class="special">(</span> <span class="special">*</span><span class="identifier">init</span> <span class="special">==</span> <span class="identifier">v</span> <span class="special">)</span> <span class="special">;</span>

<span class="identifier">optional</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">&gt;</span> <span class="identifier">init2</span> <span class="special">(</span> <span class="identifier">init</span> <span class="special">)</span> <span class="special">;</span>
<span class="identifier">assert</span> <span class="special">(</span> <span class="special">*</span><span class="identifier">init2</span> <span class="special">==</span> <span class="identifier">v</span> <span class="special">)</span> <span class="special">;</span>

<span class="identifier">v</span> <span class="special">=</span> <span class="number">3</span> <span class="special">;</span>

<span class="identifier">assert</span> <span class="special">(</span> <span class="special">*</span><span class="identifier">init</span>  <span class="special">==</span> <span class="number">3</span> <span class="special">)</span> <span class="special">;</span>
<span class="identifier">assert</span> <span class="special">(</span> <span class="special">*</span><span class="identifier">init2</span> <span class="special">==</span> <span class="number">3</span> <span class="special">)</span> <span class="special">;</span>
</pre>
            </li>
</ul></div>
<p>
          <span class="inlinemediaobject"><img src="../../../images/space.png" alt="space"></span>
        </p>
<a name="reference_optional_ref_ctor_from_opt_U"></a><div class="blockquote"><blockquote class="blockquote"><p>
            <code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">U</span><span class="special">&gt;</span> <span class="keyword">explicit</span>
            <span class="identifier">optional</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">&amp;&gt;::</span><span class="identifier">optional</span> <span class="special">(</span>
            <span class="identifier">optional</span><span class="special">&lt;</span><span class="identifier">U</span><span class="special">&amp;&gt;</span>
            <span class="keyword">const</span><span class="special">&amp;</span>
            <span class="identifier">rhs</span> <span class="special">)</span>
            <span class="keyword">noexcept</span> <span class="special">;</span></code>
          </p></blockquote></div>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
              <span class="bold"><strong>Requires:</strong></span> <code class="computeroutput"><span class="identifier">is_convertible</span><span class="special">&lt;</span><span class="identifier">U</span><span class="special">&amp;,</span> <span class="identifier">T</span><span class="special">&amp;&gt;::</span><span class="identifier">value</span></code>
              is <code class="computeroutput"><span class="keyword">true</span></code>.
            </li>
<li class="listitem">
              <span class="bold"><strong>Effects: </strong></span> Initializes <code class="computeroutput"><span class="identifier">ref</span></code> with expression <code class="computeroutput"><span class="identifier">rhs</span><span class="special">.</span><span class="identifier">ref</span></code>.
            </li>
<li class="listitem">
              <span class="bold"><strong>Postconditions:</strong></span> <code class="computeroutput"><span class="keyword">bool</span><span class="special">(*</span><span class="keyword">this</span><span class="special">)</span> <span class="special">==</span> <span class="keyword">bool</span><span class="special">(</span><span class="identifier">rhs</span><span class="special">)</span></code>.
            </li>
</ul></div>
<p>
          <span class="inlinemediaobject"><img src="../../../images/space.png" alt="space"></span>
        </p>
<a name="reference_optional_ref_assign_none_t"></a><div class="blockquote"><blockquote class="blockquote"><p>
            <code class="computeroutput"><span class="identifier">optional</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">&amp;&gt;::</span><span class="keyword">operator</span><span class="special">=</span> <span class="special">(</span> <span class="identifier">none_t</span>
            <span class="special">)</span> <span class="keyword">noexcept</span>
            <span class="special">;</span></code>
          </p></blockquote></div>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
              <span class="bold"><strong>Effects: </strong></span> Assigns <code class="computeroutput"><span class="identifier">ref</span></code>
              with expression <code class="computeroutput"><span class="keyword">nullptr</span></code>.
            </li>
<li class="listitem">
              <span class="bold"><strong>returns:</strong></span> <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>.
            </li>
<li class="listitem">
              <span class="bold"><strong>Postconditions:</strong></span> <code class="computeroutput"><span class="keyword">bool</span><span class="special">(*</span><span class="keyword">this</span><span class="special">)</span> <span class="special">==</span> <span class="keyword">false</span></code>.
            </li>
</ul></div>
<a name="reference_optional_ref_copy_assign"></a><div class="blockquote"><blockquote class="blockquote"><p>
            <code class="computeroutput"><span class="identifier">optional</span><span class="special">&amp;</span>
            <span class="identifier">optional</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">&amp;&gt;::</span><span class="keyword">operator</span><span class="special">=</span> <span class="special">(</span> <span class="identifier">optional</span>
            <span class="keyword">const</span><span class="special">&amp;</span>
            <span class="identifier">rhs</span> <span class="special">)</span>
            <span class="keyword">noexcept</span> <span class="special">;</span></code>
          </p></blockquote></div>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
              <span class="bold"><strong>Effects: </strong></span> Assigns <code class="computeroutput"><span class="identifier">ref</span></code>
              with expression <code class="computeroutput"><span class="identifier">rhs</span><span class="special">.</span><span class="identifier">ref</span></code>.
            </li>
<li class="listitem">
              <span class="bold"><strong>returns:</strong></span> <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>.
            </li>
<li class="listitem">
              <span class="bold"><strong>Postconditions:</strong></span> <code class="computeroutput"><span class="keyword">bool</span><span class="special">(*</span><span class="keyword">this</span><span class="special">)</span> <span class="special">==</span> <span class="keyword">bool</span><span class="special">(</span><span class="identifier">rhs</span><span class="special">)</span></code>.
            </li>
<li class="listitem">
              <span class="bold"><strong>Notes:</strong></span> This behaviour is called <span class="emphasis"><em>rebinding
              semantics</em></span>. See <a class="link" href="../../tutorial/optional_references/rebinding_semantics_for_assignment_of_optional_references.html" title="Rebinding semantics for assignment of optional references">here</a>
              for details.
            </li>
<li class="listitem">
              <span class="bold"><strong>Example:</strong></span>
<pre class="programlisting"><span class="keyword">int</span> <span class="identifier">a</span> <span class="special">=</span> <span class="number">1</span> <span class="special">;</span>
<span class="keyword">int</span> <span class="identifier">b</span> <span class="special">=</span> <span class="number">2</span> <span class="special">;</span>
<span class="identifier">T</span><span class="special">&amp;</span> <span class="identifier">ra</span> <span class="special">=</span> <span class="identifier">a</span> <span class="special">;</span>
<span class="identifier">T</span><span class="special">&amp;</span> <span class="identifier">rb</span> <span class="special">=</span> <span class="identifier">b</span> <span class="special">;</span>
<span class="identifier">optional</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">&amp;&gt;</span> <span class="identifier">def</span> <span class="special">;</span>
<span class="identifier">optional</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">&amp;&gt;</span> <span class="identifier">ora</span><span class="special">(</span><span class="identifier">ra</span><span class="special">)</span> <span class="special">;</span>
<span class="identifier">optional</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">&amp;&gt;</span> <span class="identifier">orb</span><span class="special">(</span><span class="identifier">rb</span><span class="special">)</span> <span class="special">;</span>

<span class="identifier">def</span> <span class="special">=</span> <span class="identifier">orb</span> <span class="special">;</span> <span class="comment">// binds 'def' to 'b' through 'rb' wrapped within 'orb'</span>
<span class="identifier">assert</span> <span class="special">(</span> <span class="special">*</span><span class="identifier">def</span> <span class="special">==</span> <span class="identifier">b</span> <span class="special">)</span> <span class="special">;</span>
<span class="special">*</span><span class="identifier">def</span> <span class="special">=</span> <span class="identifier">ora</span> <span class="special">;</span> <span class="comment">// changes the value of 'b' to a copy of the value of 'a'</span>
<span class="identifier">assert</span> <span class="special">(</span> <span class="identifier">b</span> <span class="special">==</span> <span class="identifier">a</span> <span class="special">)</span> <span class="special">;</span>
<span class="keyword">int</span> <span class="identifier">c</span> <span class="special">=</span> <span class="number">3</span><span class="special">;</span>
<span class="keyword">int</span><span class="special">&amp;</span> <span class="identifier">rc</span> <span class="special">=</span> <span class="identifier">c</span> <span class="special">;</span>
<span class="identifier">optional</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">&amp;&gt;</span> <span class="identifier">orc</span><span class="special">(</span><span class="identifier">rc</span><span class="special">)</span> <span class="special">;</span>
<span class="identifier">ora</span> <span class="special">=</span> <span class="identifier">orc</span> <span class="special">;</span> <span class="comment">// REBINDS ora to 'c' through 'rc'</span>
<span class="identifier">c</span> <span class="special">=</span> <span class="number">4</span> <span class="special">;</span>
<span class="identifier">assert</span> <span class="special">(</span> <span class="special">*</span><span class="identifier">ora</span> <span class="special">==</span> <span class="number">4</span> <span class="special">)</span> <span class="special">;</span>
</pre>
            </li>
</ul></div>
<a name="reference_optional_ref_assign_optional_U"></a><div class="blockquote"><blockquote class="blockquote"><p>
            <code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">U</span><span class="special">&gt;</span> <span class="identifier">optional</span><span class="special">&amp;</span> <span class="identifier">optional</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">&amp;&gt;::</span><span class="keyword">operator</span><span class="special">=</span> <span class="special">(</span> <span class="identifier">optional</span><span class="special">&lt;</span><span class="identifier">U</span><span class="special">&amp;&gt;</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">rhs</span>
            <span class="special">)</span> <span class="keyword">noexcept</span>
            <span class="special">;</span></code>
          </p></blockquote></div>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
              <span class="bold"><strong>Requires:</strong></span> <code class="computeroutput"><span class="identifier">is_convertible</span><span class="special">&lt;</span><span class="identifier">U</span><span class="special">&amp;,</span> <span class="identifier">T</span><span class="special">&amp;&gt;::</span><span class="identifier">value</span></code>
              is <code class="computeroutput"><span class="keyword">true</span></code>.
            </li>
<li class="listitem">
              <span class="bold"><strong>Effects: </strong></span> Assigns <code class="computeroutput"><span class="identifier">ref</span></code>
              with expression <code class="computeroutput"><span class="identifier">rhs</span><span class="special">.</span><span class="identifier">ref</span></code>.
            </li>
<li class="listitem">
              <span class="bold"><strong>returns:</strong></span> <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>.
            </li>
<li class="listitem">
              <span class="bold"><strong>Postconditions:</strong></span> <code class="computeroutput"><span class="keyword">bool</span><span class="special">(*</span><span class="keyword">this</span><span class="special">)</span> <span class="special">==</span> <span class="keyword">bool</span><span class="special">(</span><span class="identifier">rhs</span><span class="special">)</span></code>.
            </li>
</ul></div>
<p>
          <span class="inlinemediaobject"><img src="../../../images/space.png" alt="space"></span>
        </p>
<a name="reference_optional_ref_assign_R"></a><div class="blockquote"><blockquote class="blockquote"><p>
            <code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">R</span><span class="special">&gt;</span> <span class="identifier">optional</span><span class="special">&amp;</span> <span class="identifier">optional</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">&amp;&gt;::</span><span class="keyword">operator</span><span class="special">=</span> <span class="special">(</span> <span class="identifier">R</span><span class="special">&amp;&amp;</span> <span class="identifier">r</span>
            <span class="special">)</span> <span class="keyword">noexcept</span>
            <span class="special">;</span></code>
          </p></blockquote></div>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
              <span class="bold"><strong>Effects: </strong></span> Assigns <code class="computeroutput"><span class="identifier">ref</span></code>
              with expression <code class="computeroutput"><span class="identifier">r</span></code>.
            </li>
<li class="listitem">
              <span class="bold"><strong>returns:</strong></span> <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>.
            </li>
<li class="listitem">
              <span class="bold"><strong>Postconditions:</strong></span> <code class="computeroutput"><span class="keyword">bool</span><span class="special">(*</span><span class="keyword">this</span><span class="special">)</span> <span class="special">==</span> <span class="keyword">true</span></code>.
            </li>
<li class="listitem">
              <span class="bold"><strong>Remarks:</strong></span> Unless <code class="computeroutput"><span class="identifier">R</span></code>
              is an lvalue reference, the program is ill-formed. This function does
              not participate in overload resolution if <code class="computeroutput"><span class="identifier">decay</span><span class="special">&lt;</span><span class="identifier">R</span><span class="special">&gt;</span></code> is an instance of <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">optional</span></code>.
            </li>
<li class="listitem">
              <span class="bold"><strong>Example:</strong></span>
<pre class="programlisting"><span class="keyword">int</span> <span class="identifier">a</span> <span class="special">=</span> <span class="number">1</span> <span class="special">;</span>
<span class="keyword">int</span> <span class="identifier">b</span> <span class="special">=</span> <span class="number">2</span> <span class="special">;</span>
<span class="identifier">T</span><span class="special">&amp;</span> <span class="identifier">ra</span> <span class="special">=</span> <span class="identifier">a</span> <span class="special">;</span>
<span class="identifier">T</span><span class="special">&amp;</span> <span class="identifier">rb</span> <span class="special">=</span> <span class="identifier">b</span> <span class="special">;</span>
<span class="identifier">optional</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">&amp;&gt;</span> <span class="identifier">def</span> <span class="special">;</span>
<span class="identifier">optional</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">&amp;&gt;</span> <span class="identifier">opt</span><span class="special">(</span><span class="identifier">ra</span><span class="special">)</span> <span class="special">;</span>

<span class="identifier">def</span> <span class="special">=</span> <span class="identifier">rb</span> <span class="special">;</span> <span class="comment">// binds 'def' to 'b' through 'rb'</span>
<span class="identifier">assert</span> <span class="special">(</span> <span class="special">*</span><span class="identifier">def</span> <span class="special">==</span> <span class="identifier">b</span> <span class="special">)</span> <span class="special">;</span>
<span class="special">*</span><span class="identifier">def</span> <span class="special">=</span> <span class="identifier">a</span> <span class="special">;</span> <span class="comment">// changes the value of 'b' to a copy of the value of 'a'</span>
<span class="identifier">assert</span> <span class="special">(</span> <span class="identifier">b</span> <span class="special">==</span> <span class="identifier">a</span> <span class="special">)</span> <span class="special">;</span>
<span class="keyword">int</span> <span class="identifier">c</span> <span class="special">=</span> <span class="number">3</span><span class="special">;</span>
<span class="keyword">int</span><span class="special">&amp;</span> <span class="identifier">rc</span> <span class="special">=</span> <span class="identifier">c</span> <span class="special">;</span>
<span class="identifier">opt</span> <span class="special">=</span> <span class="identifier">rc</span> <span class="special">;</span> <span class="comment">// REBINDS to 'c' through 'rc'</span>
<span class="identifier">c</span> <span class="special">=</span> <span class="number">4</span> <span class="special">;</span>
<span class="identifier">assert</span> <span class="special">(</span> <span class="special">*</span><span class="identifier">opt</span> <span class="special">==</span> <span class="number">4</span> <span class="special">)</span> <span class="special">;</span>
</pre>
            </li>
</ul></div>
<p>
          <span class="inlinemediaobject"><img src="../../../images/space.png" alt="space"></span>
        </p>
<a name="reference_optional_ref_emplace_R"></a><div class="blockquote"><blockquote class="blockquote"><p>
            <code class="computeroutput"><span class="keyword">void</span> <span class="identifier">optional</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">&amp;&gt;::</span><span class="identifier">emplace</span><span class="special">(</span> <span class="identifier">R</span><span class="special">&amp;&amp;</span> <span class="identifier">r</span>
            <span class="special">)</span> <span class="keyword">noexcept</span>
            <span class="special">;</span></code>
          </p></blockquote></div>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
              <span class="bold"><strong>Effects: </strong></span> Assigns <code class="computeroutput"><span class="identifier">ref</span></code>
              with expression <code class="computeroutput"><span class="identifier">r</span></code>.
            </li>
<li class="listitem">
              <span class="bold"><strong>Postconditions:</strong></span> <code class="computeroutput"><span class="keyword">bool</span><span class="special">(*</span><span class="keyword">this</span><span class="special">)</span> <span class="special">==</span> <span class="keyword">true</span></code>.
            </li>
<li class="listitem">
              <span class="bold"><strong>Remarks:</strong></span> Unless <code class="computeroutput"><span class="identifier">R</span></code>
              is an lvalue reference, the program is ill-formed. This function does
              not participate in overload resolution if <code class="computeroutput"><span class="identifier">decay</span><span class="special">&lt;</span><span class="identifier">R</span><span class="special">&gt;</span></code> is an instance of <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">optional</span></code>.
            </li>
</ul></div>
<p>
          <span class="inlinemediaobject"><img src="../../../images/space.png" alt="space"></span>
        </p>
<a name="reference_optional_ref_get"></a><div class="blockquote"><blockquote class="blockquote"><p>
            <code class="computeroutput"><span class="identifier">T</span><span class="special">&amp;</span>
            <span class="identifier">optional</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">&amp;&gt;::</span><span class="identifier">get</span><span class="special">()</span> <span class="keyword">const</span> <span class="special">;</span></code>
          </p></blockquote></div>
<div class="blockquote"><blockquote class="blockquote"><p>
            <code class="computeroutput"><span class="identifier">T</span><span class="special">&amp;</span>
            <span class="identifier">optional</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">&amp;&gt;::</span><span class="keyword">operator</span> <span class="special">*()</span>
            <span class="keyword">const</span> <span class="special">;</span></code>
          </p></blockquote></div>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
              <span class="bold"><strong>Requires:</strong></span> <code class="computeroutput"><span class="keyword">bool</span><span class="special">(*</span><span class="keyword">this</span><span class="special">)</span> <span class="special">==</span> <span class="keyword">true</span></code>.
            </li>
<li class="listitem">
              <span class="bold"><strong>Effects: </strong></span> Returns <code class="computeroutput"><span class="special">*</span><span class="identifier">ref</span></code>.
            </li>
<li class="listitem">
              <span class="bold"><strong>Throws: </strong></span> Nothing.
            </li>
<li class="listitem">
              <span class="bold"><strong>Example:</strong></span>
<pre class="programlisting"><span class="identifier">T</span> <span class="identifier">v</span> <span class="special">;</span>
<span class="identifier">T</span><span class="special">&amp;</span> <span class="identifier">vref</span> <span class="special">=</span> <span class="identifier">v</span> <span class="special">;</span>
<span class="identifier">optional</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">&amp;&gt;</span> <span class="identifier">opt</span> <span class="special">(</span> <span class="identifier">vref</span> <span class="special">);</span>
<span class="identifier">T</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">vref2</span> <span class="special">=</span> <span class="special">*</span><span class="identifier">opt</span><span class="special">;</span>
<span class="identifier">assert</span> <span class="special">(</span> <span class="identifier">vref2</span> <span class="special">==</span> <span class="identifier">v</span> <span class="special">)</span> <span class="special">;</span>
<span class="special">++</span> <span class="identifier">v</span> <span class="special">;</span>
<span class="identifier">assert</span> <span class="special">(</span> <span class="special">*</span><span class="identifier">opt</span> <span class="special">==</span> <span class="identifier">v</span> <span class="special">)</span> <span class="special">;</span>
</pre>
            </li>
</ul></div>
<p>
          <span class="inlinemediaobject"><img src="../../../images/space.png" alt="space"></span>
        </p>
<a name="reference_optional_ref_arrow"></a><div class="blockquote"><blockquote class="blockquote"><p>
            <code class="computeroutput"><span class="identifier">T</span><span class="special">*</span>
            <span class="identifier">optional</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">&amp;&gt;::</span><span class="keyword">operator</span> <span class="special">-&gt;</span>
            <span class="special">()</span> <span class="keyword">const</span>
            <span class="special">;</span></code>
          </p></blockquote></div>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
              <span class="bold"><strong>Requires:</strong></span> <code class="computeroutput"><span class="keyword">bool</span><span class="special">(*</span><span class="keyword">this</span><span class="special">)</span> <span class="special">==</span> <span class="keyword">true</span></code>.
            </li>
<li class="listitem">
              <span class="bold"><strong>Effects: </strong></span> Returns <code class="computeroutput"><span class="identifier">ref</span></code>.
            </li>
<li class="listitem">
              <span class="bold"><strong>Throws: </strong></span> Nothing.
            </li>
</ul></div>
<p>
          <span class="inlinemediaobject"><img src="../../../images/space.png" alt="space"></span>
        </p>
<a name="reference_optional_ref_value"></a><div class="blockquote"><blockquote class="blockquote"><p>
            <code class="computeroutput"><span class="identifier">T</span><span class="special">&amp;</span>
            <span class="identifier">optional</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">&amp;&gt;::</span><span class="identifier">value</span><span class="special">()</span> <span class="keyword">const</span> <span class="special">;</span></code>
          </p></blockquote></div>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
              <span class="bold"><strong>Effects:</strong></span> Equivalent to <code class="computeroutput"><span class="keyword">return</span> <span class="keyword">bool</span><span class="special">(*</span><span class="keyword">this</span><span class="special">)</span> <span class="special">?</span> <span class="special">*</span><span class="identifier">val</span> <span class="special">:</span> <span class="keyword">throw</span> <span class="identifier">bad_optional_access</span><span class="special">();</span></code>.
            </li></ul></div>
<p>
          <span class="inlinemediaobject"><img src="../../../images/space.png" alt="space"></span>
        </p>
<a name="reference_optional_ref_value_or"></a><div class="blockquote"><blockquote class="blockquote"><p>
            <code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">R</span><span class="special">&gt;</span> <span class="identifier">T</span><span class="special">&amp;</span> <span class="identifier">optional</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">&amp;&gt;::</span><span class="identifier">value_or</span><span class="special">(</span> <span class="identifier">R</span><span class="special">&amp;&amp;</span> <span class="identifier">r</span>
            <span class="special">)</span> <span class="keyword">const</span>
            <span class="keyword">noexcept</span><span class="special">;</span></code>
          </p></blockquote></div>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
              <span class="bold"><strong>Effects:</strong></span> Equivalent to <code class="computeroutput"><span class="keyword">if</span> <span class="special">(*</span><span class="keyword">this</span><span class="special">)</span> <span class="keyword">return</span> <span class="special">**</span><span class="keyword">this</span><span class="special">;</span> <span class="keyword">else</span> <span class="keyword">return</span>
              <span class="identifier">r</span><span class="special">;</span></code>.
            </li>
<li class="listitem">
              <span class="bold"><strong>Remarks:</strong></span> Unless <code class="computeroutput"><span class="identifier">R</span></code>
              is an lvalue reference, the program is ill-formed.
            </li>
</ul></div>
<p>
          <span class="inlinemediaobject"><img src="../../../images/space.png" alt="space"></span>
        </p>
<a name="reference_optional_ref_value_or_eval"></a><div class="blockquote"><blockquote class="blockquote"><p>
            <code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">F</span><span class="special">&gt;</span> <span class="identifier">T</span><span class="special">&amp;</span> <span class="identifier">optional</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">&amp;&gt;::</span><span class="identifier">value_or</span><span class="special">(</span> <span class="identifier">F</span> <span class="identifier">f</span> <span class="special">)</span> <span class="keyword">const</span> <span class="special">;</span></code>
          </p></blockquote></div>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
              <span class="bold"><strong>Effects:</strong></span> Equivalent to <code class="computeroutput"><span class="keyword">if</span> <span class="special">(*</span><span class="keyword">this</span><span class="special">)</span> <span class="keyword">return</span> <span class="special">**</span><span class="keyword">this</span><span class="special">;</span> <span class="keyword">else</span> <span class="keyword">return</span>
              <span class="identifier">f</span><span class="special">();</span></code>.
            </li>
<li class="listitem">
              <span class="bold"><strong>Remarks:</strong></span> Unless <code class="computeroutput"><span class="keyword">decltype</span><span class="special">(</span><span class="identifier">f</span><span class="special">())</span></code> is an lvalue reference, the program
              is ill-formed.
            </li>
</ul></div>
<p>
          <span class="inlinemediaobject"><img src="../../../images/space.png" alt="space"></span>
        </p>
<a name="reference_optional_ref_map"></a><div class="blockquote"><blockquote class="blockquote"><p>
            <code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">F</span><span class="special">&gt;</span> <span class="keyword">auto</span> <span class="identifier">optional</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">&amp;&gt;::</span><span class="identifier">map</span><span class="special">(</span> <span class="identifier">F</span> <span class="identifier">f</span> <span class="special">)</span> <span class="keyword">const</span> <span class="special">-&gt;</span> </code><span class="emphasis"><em>see below</em></span><code class="computeroutput"><span class="special">;</span></code>
          </p></blockquote></div>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
              <span class="bold"><strong>Effects:</strong></span> Equivalent to <code class="computeroutput"><span class="keyword">if</span> <span class="special">(*</span><span class="keyword">this</span><span class="special">)</span> <span class="keyword">return</span> <span class="identifier">f</span><span class="special">(**</span><span class="keyword">this</span><span class="special">);</span> <span class="keyword">else</span> <span class="keyword">return</span> <span class="identifier">none</span><span class="special">;</span></code>.
            </li>
<li class="listitem">
              <span class="bold"><strong>Remarks:</strong></span> The return type of this function
              is <code class="computeroutput"><span class="identifier">optional</span><span class="special">&lt;</span><span class="keyword">decltype</span><span class="special">(</span><span class="identifier">f</span><span class="special">(**</span><span class="keyword">this</span><span class="special">))&gt;</span></code>.
            </li>
</ul></div>
<p>
          <span class="inlinemediaobject"><img src="../../../images/space.png" alt="space"></span>
        </p>
<a name="reference_optional_ref_flat_map"></a><div class="blockquote"><blockquote class="blockquote"><p>
            <code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">F</span><span class="special">&gt;</span> <span class="keyword">auto</span> <span class="identifier">optional</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">&amp;&gt;::</span><span class="identifier">flat_map</span><span class="special">(</span>
            <span class="identifier">F</span> <span class="identifier">f</span>
            <span class="special">)</span> <span class="keyword">const</span>
            <span class="special">-&gt;</span> </code><span class="emphasis"><em>see below</em></span><code class="computeroutput"><span class="special">;</span></code>
          </p></blockquote></div>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
              <span class="bold"><strong>Requires:</strong></span> The return type of expression
              <code class="computeroutput"><span class="identifier">f</span><span class="special">(**</span><span class="keyword">this</span><span class="special">)</span></code>
              is <code class="computeroutput"><span class="identifier">optional</span><span class="special">&lt;</span><span class="identifier">U</span><span class="special">&gt;</span></code>
              for some object or reference type <code class="computeroutput"><span class="identifier">U</span></code>.
            </li>
<li class="listitem">
              <span class="bold"><strong>Effects:</strong></span> Equivalent to <code class="computeroutput"><span class="keyword">if</span> <span class="special">(*</span><span class="keyword">this</span><span class="special">)</span> <span class="keyword">return</span> <span class="identifier">f</span><span class="special">(**</span><span class="keyword">this</span><span class="special">);</span> <span class="keyword">else</span> <span class="keyword">return</span> <span class="identifier">none</span><span class="special">;</span></code>.
            </li>
<li class="listitem">
              <span class="bold"><strong>Remarks:</strong></span> The return type of this function
              is <code class="computeroutput"><span class="identifier">optional</span><span class="special">&lt;</span><span class="identifier">U</span><span class="special">&gt;</span></code>.
            </li>
</ul></div>
<p>
          <span class="inlinemediaobject"><img src="../../../images/space.png" alt="space"></span>
        </p>
<a name="reference_optional_ref_get_ptr"></a><div class="blockquote"><blockquote class="blockquote"><p>
            <code class="computeroutput"><span class="identifier">T</span><span class="special">*</span>
            <span class="identifier">optional</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">&amp;&gt;::</span><span class="identifier">get_ptr</span> <span class="special">()</span>
            <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span></code>
          </p></blockquote></div>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
              <span class="bold"><strong>Returns:</strong></span> <code class="computeroutput"><span class="identifier">ref</span></code>.
            </li></ul></div>
<p>
          <span class="inlinemediaobject"><img src="../../../images/space.png" alt="space"></span>
        </p>
<a name="reference_optional_ref_operator_bool"></a><div class="blockquote"><blockquote class="blockquote"><p>
            <code class="computeroutput"><span class="keyword">bool</span> <span class="identifier">has_value</span><span class="special">()</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span></code>
          </p></blockquote></div>
<div class="blockquote"><blockquote class="blockquote"><p>
            <code class="computeroutput"><span class="identifier">optional</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">&amp;&gt;::</span><span class="keyword">operator</span> <span class="keyword">bool</span>
            <span class="special">()</span> <span class="keyword">const</span>
            <span class="keyword">noexcept</span><span class="special">;</span></code>
          </p></blockquote></div>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
              <span class="bold"><strong>Returns:</strong></span> <code class="computeroutput"><span class="keyword">bool</span><span class="special">(</span><span class="identifier">ref</span><span class="special">)</span></code>.
            </li></ul></div>
<p>
          <span class="inlinemediaobject"><img src="../../../images/space.png" alt="space"></span>
        </p>
<a name="reference_optional_ref_operator_not"></a><div class="blockquote"><blockquote class="blockquote"><p>
            <code class="computeroutput"><span class="identifier">optional</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">&amp;&gt;::</span><span class="keyword">operator</span> <span class="special">!</span> <span class="special">()</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span></code>
          </p></blockquote></div>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
              <span class="bold"><strong>Returns:</strong></span> <code class="computeroutput"><span class="special">!</span><span class="keyword">bool</span><span class="special">(</span><span class="identifier">ref</span><span class="special">)</span></code>.
            </li></ul></div>
<p>
          <span class="inlinemediaobject"><img src="../../../images/space.png" alt="space"></span>
        </p>
<a name="reference_optional_ref_reset"></a><div class="blockquote"><blockquote class="blockquote"><p>
            <code class="computeroutput"><span class="keyword">void</span> <span class="identifier">optional</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">&amp;&gt;::</span><span class="identifier">reset</span><span class="special">()</span> <span class="keyword">noexcept</span><span class="special">;</span></code>
          </p></blockquote></div>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
              <span class="bold"><strong>Effects:</strong></span> Same as <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span> <span class="special">=</span> <span class="identifier">none</span></code>.
            </li></ul></div>
<p>
          <span class="inlinemediaobject"><img src="../../../images/space.png" alt="space"></span>
        </p>
<a name="reference_optional_ref_reset_value"></a><div class="blockquote"><blockquote class="blockquote"><p>
            <code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">R</span><span class="special">&gt;</span> <span class="keyword">void</span> <span class="identifier">optional</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">&amp;&gt;::</span><span class="identifier">reset</span> <span class="special">(</span> <span class="identifier">R</span><span class="special">&amp;&amp;</span>
            <span class="identifier">r</span><span class="special">)</span>
            <span class="keyword">noexcept</span><span class="special">;</span></code>
          </p></blockquote></div>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
              <span class="bold"><strong>Effects:</strong></span> Equivalent to <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span> <span class="special">=</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">forward</span><span class="special">&lt;</span><span class="identifier">R</span><span class="special">&gt;(</span><span class="identifier">r</span><span class="special">)</span></code>.
            </li>
<li class="listitem">
              <span class="bold"><strong>Remarks:</strong></span> This function is deprecated.
            </li>
</ul></div>
<p>
          <span class="inlinemediaobject"><img src="../../../images/space.png" alt="space"></span>
        </p>
<a name="reference_optional_ref_is_initialized"></a><div class="blockquote"><blockquote class="blockquote"><p>
            <code class="computeroutput"><span class="keyword">bool</span> <span class="identifier">optional</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">&amp;&gt;::</span><span class="identifier">is_initialized</span><span class="special">()</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span></code>
          </p></blockquote></div>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
              <span class="bold"><strong>Effects:</strong></span> Equivalent to <code class="computeroutput"><span class="keyword">return</span> <span class="keyword">bool</span><span class="special">(*</span><span class="keyword">this</span><span class="special">)</span></code>.
            </li>
<li class="listitem">
              <span class="bold"><strong>Remarks:</strong></span> This function is deprecated.
            </li>
</ul></div>
<p>
          <span class="inlinemediaobject"><img src="../../../images/space.png" alt="space"></span>
        </p>
<a name="reference_optional_ref_get_value_or_value"></a><div class="blockquote"><blockquote class="blockquote"><p>
            <code class="computeroutput"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">R</span><span class="special">&gt;</span> <span class="identifier">T</span><span class="special">&amp;</span> <span class="identifier">optional</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">&amp;&gt;::</span><span class="identifier">get_value_or</span><span class="special">(</span> <span class="identifier">R</span><span class="special">&amp;&amp;</span> <span class="identifier">r</span>
            <span class="special">)</span> <span class="keyword">const</span>
            <span class="keyword">noexcept</span><span class="special">;</span></code>
          </p></blockquote></div>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
              <span class="bold"><strong>Effects:</strong></span> Equivalent to <code class="computeroutput"><span class="keyword">return</span> <span class="identifier">value_or</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">forward</span><span class="special">&lt;</span><span class="identifier">R</span><span class="special">&gt;(</span><span class="identifier">r</span><span class="special">);</span></code>.
            </li>
<li class="listitem">
              <span class="bold"><strong>Remarks:</strong></span> This function is deprecated.
            </li>
</ul></div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2003-2007 Fernando Luis Cacciola Carballal<br>Copyright © 2014-2021 Andrzej Krzemieński<p>
        Distributed under the Boost Software License, Version 1.0. (See accompanying
        file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
      </p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="detailed_semantics___optional_values.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../../optional/reference/header__boost_optional_optional_hpp_.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="detailed_semantics___free_functions.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
